//
//  FloorCollectionViewCell.h
//  OfficeBook
//
//  Created by 孙晓奇 on 15/9/23.
//  Copyright © 2015年 sunny. All rights reserved.
//

#import "FloorCollectionViewCell.h"

@implementation FloorCollectionViewCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        _imageView = [[UIImageView alloc] init];
        _titleLabel = [[UILabel alloc] init];
        
        [self.contentView addSubview:_imageView];
        [self.contentView addSubview:_titleLabel];
        
        [_imageView setClipsToBounds:YES];
        [_imageView setContentMode:UIViewContentModeScaleAspectFill]; //等比例拉伸
        _imageView.layer.cornerRadius = 4.f;
        
        [_titleLabel setTextAlignment:NSTextAlignmentCenter];
        [_titleLabel setBackgroundColor:[UIColor clearColor]];
        [_titleLabel setFont:[UIFont systemFontOfSize:11]];
        _titleLabel.adjustsFontSizeToFitWidth = YES;
        _titleLabel.minimumScaleFactor = 0.5;
        [_titleLabel setTextColor:[UIColor blackColor]];
        
        [self.titleLabel makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.left);
            make.right.equalTo(self.contentView.right);
            make.bottom.equalTo(self.contentView.bottom);
            make.height.equalTo(@(16));
        }];
        [self.imageView makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView.top);
            make.left.equalTo(self.contentView.left);
            make.bottom.equalTo(self.titleLabel.top);
            make.right.equalTo(self.contentView.right);
        }];
    }
    return self;
}


@end
